gradescope late penalty tutorial

This module process the gradescope generated csv grades files and the output directories, and use canvas api to post grade to students, with late penalty and the messages.

Authentication & Initialization

To use the canvas API functionalities, you will have to provide API credentials in order to communicate to canvas. For more details, visit how to set credentials

Be sure to provide with the correct course_id and assignment_id of your target assignment to the gradescope_grade object. You can also double check in the output message of whether you have provided the correct credentials, course, and assignment to the object.

from LatePenalty.gradescope import gradescope_grade
grade = gradescope_grade("../../../credentials.json",
                         course_id=45059,
                         assignment_id=641795,
                         gradescope_fp="../data/gradescope_example.csv",
                         verbosity=1,
                        )
Authorization Successful!
Course Set:  COGS 118A - Supvr/Mach Learning Algorithms - Fleischer [SP23] 
Getting List of Users... This might take a while...
Users Fetch Complete! The course has 169 users.
Assignment A1 Link!

The gradescope generated csv file will look something like the following. For each assignment, the score and lateness are recorded. We can use those information to calculate the late day balance and to apply appropriate late penalties to student.

Understand the Gradescope Export csv File

# take a look at the csv file
grade.gradescope
First Name Last Name SID Assignment 1 Assignment 1 - Manual Grading Assignment 1 - Lateness (H:M:S)
Email
kkdwdx FVPqOMpv jhjx zPBPCJwDL 0.650 1.8 24:01:41
JhThhnUaOPDUIEb BVTLaj JL bJhgVCFRz 0.900 2.1 00:00:00
dbAbqg uaNTaJHacrK PNrEkH DqEMLsESM 0.475 1.9 00:00:00

From the table, we will be only interested in the target assignment Assignment 1, and the Lateness of each student’s submission, found in the column Assignment 1 - Lateness (H:M:S).

Sometime, an assignment might have multiple components. For example, in COGS 118A, we have a mixture of autograded jupyter notebook and a manual grading component for each assignment. This package will post the summation of score between the components, and use the target_assignment to calculate late penalty.

Post Grade

Before each post grade, it is nice to do a sanity check before posting to canvas. You can achieve that by specifying post=False in the gradescope_grade.post_to_canvas

grade.post_to_canvas(
    target_assignment="Assignment 1",
    passed_assignments=[],
    components=["Assignment 1", "Assignment 1 - Manual Grading"],
    post=False
)
Force Posting Disabled. If you need to completely overwrite student scores, please set force=True
Post Disabled
The message is: 
Assignment 1: 
Late Submission: 25 Hours Late
Slip Credit Used. No late penalty applied
Remaining Slip Credit: 95 Hours

Post Disabled
The message is: 
Assignment 1: 
Submitted intime
Remaining Slip Credit: 120 Hours

Post Disabled
The message is: 
Assignment 1: 
Submitted intime
Remaining Slip Credit: 120 Hours